<?php
namespace Home\Controller;
use Think\Controller;
class BrandsController extends BaseController{
	public function index(){
		if($_GET['p'] == ''){
			$_GET['p'] = 1;
		}
		$flag = I('flag');
		if($flag == ''){
			$categoryInfo = SearchOne('Category','flag',$THINK.CONTROLLER_NAME);
			$categoryInfo = SearchOne('Category','parent_id',$categoryInfo['id']);
		}else{
			$categoryInfo = SearchOne('Category','flag',$flag);
		}
		$category_id = $categoryInfo['id'];
		$pageView	= M('Page') -> where(array('category_id' => $category_id)) -> find();
		$kyyf		= M('Gallery') -> where(array('cid' => $pageView['cid'])) -> select();
		$this		-> assign('category_id',$category_id);
		$this		-> assign('flag',$flag);
		$this		-> assign('categoryInfo',$categoryInfo);
		$this		-> assign('pageView',$pageView);
		$this		-> assign('kyyf',$kyyf);
		$this		-> display('brands');
	}
}